package whisper.service.constants;

/**
 * Created by JT on 2017/11/18.
 */
public enum TaskStatus {

    WAIT(0, "等待"),
    RUNNING(1, "执行"),
    RETRY_1(2, "重试"),
    RETRY_2(3, "重试"),
    RETRY_3(4, "重试"),
    FAILED(5, "失败"),
    SUCCESS(10, "成功");


    private int code;
    private String value;

    private TaskStatus(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public static String getValue(int code) {
        for (TaskStatus status : values())
            if (status.code == code) return status.value;
        return WAIT.value;
    }
}
